<template>
  <LoginHeader>联合登录</LoginHeader>
  <section class="container">
    <nav class="tab">
      <a @click="completeInformation(true)" :class="{active:hasAccount}" href="javascript:;">
        <i class="iconfont icon-bind" />
        <span>已有小兔鲜账号，请绑定手机</span>
      </a>
      <a @click="completeInformation(false)" :class="{ active: !hasAccount }" href="javascript:;">
        <i class="iconfont icon-edit" />
        <span>没有小兔鲜账号，请完善资料</span>
      </a>
    </nav>
    <div class="tab-content" v-if="hasAccount">
      <!-- 已有小兔鲜账号，请绑定手机组件 -->
      <CallbackBind :nickname="nickname" :avatar="avatar" />
    </div>
    <div class="tab-content" v-else>
      <!-- 没有小兔鲜账号，请完善资料组件 -->
      <CallbackPatch />
    </div>
  </section>
  <LoginFooter />
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import LoginHeader from './login-header.vue'
import LoginFooter from './login-footer.vue'
import CallbackBind from './callback-bind.vue'
import CallbackPatch from './callback-patch.vue'
// 控制完成信息条件的切换
const hasAccount = ref(true)
const nickname = ref(null)
const avatar = ref(null)
// 控制完成信息条件的切换事件
const completeInformation = (item) => {
  hasAccount.value = item
}

</script>

<style  lang='less' scoped>
@import '../../assets/styles/mixins.less';
@import '../../assets/styles/variables.less';

.container {
  padding: 25px 0;
}

.tab {
  background: #fff;
  height: 80px;
  padding-top: 40px;
  font-size: 18px;
  text-align: center;

  a {
    color: #666;
    display: inline-block;
    width: 350px;
    line-height: 40px;
    border-bottom: 2px solid #e4e4e4;

    i {
      font-size: 22px;
      vertical-align: middle;
    }

    span {
      vertical-align: middle;
      margin-left: 4px;
    }

    &.active {
      color: @xtxColor;
      border-color: @xtxColor;
    }
  }
}

.tab-content {
  min-height: 600px;
  background: #fff;
}
</style>